#!/usr/bin/env bash

# use ./gradlew installGitHooks
# to install

# regex to validate in commit msg
commit_regex='(feat|fix|docs|style|refactor|test|chore)\((.{3,})\): (AND-\d{3,4}) (.{10,})'
error_msg="Aborting commit. Commit message does not adhere to standard format:"

if ! grep -qE "$commit_regex" "$1"; then
    echo "$error_msg" >&2
    echo "$commit_regex" >&2
    exit 1
fi
